{extend name="public/base" /}
{block name="css"}
<link rel="stylesheet" href="__INDEX__/css/create.css">
<link href="__PLUGIN__/Fileinput/css/fileinput.css" rel="stylesheet">
<style>
.col-sm-12{padding:0px;}
</style>
{/block}
{block name="container"}
<div class="panel-body panel-body-nopadding" style="padding-bottom:50px;">
    
    <div class="tishiform">*请注意！以下字段均为必填项，请全部填写，否则不能提交订单  </div>
    <form class="form-horizontal form-bordered" id="submitForm" action="" method="post" >
<div class="form-group">
    <label class="col-sm-12 control-label" style="background: #7F7F7F;text-align: center;color: #000;">订单信息
        <div style="display: inline-block;background: #7F7F7F;padding-right: 20px;float: right;font-size: 12px">
          {if condition="$Request.action eq 'update'"}
          驳回理由：<font style="color:#b50618;">{$data['reaon']}</font>
          {/if}
        </div>
    </label>
    <div class="col-sm-12" >
        <table class="table ">
            <tr>
                <td>商品名称</td>
                <td colspan="2"><input type="text" name="name" value="{$data.name ?? ''}" required></td>
                <td>面料编号</td>
                <td colspan="2"><input type="text" name="ml_num" value="{$data.ml_num ?? ''}" style="width: 100%" required></td>
                <td>面料属性</td>
                <td colspan="2"><input type="text" name="ml_style" value="{$data.ml_style ?? ''}"></td>
            </tr>
            <tr>
              <td>性别</td>
              <td colspan="2">
                <input type="radio" value="8" name="sex" style="width: 15%">男 
                <input type="radio" value="6" name="sex" style="width: 15%">女
              </td>
              <td>年份</td>
              <td colspan="2"> <input type="text" id="year" name="year" readonly></td>
              <td>季节</td>
              <td colspan="2"> 
                <select name="season" id=""  style="width: 100%;height: 100%;border: 0px;outline: none;">
                <option value="1">春季</option>
                <option value="2">夏季</option>
                <option value="3">秋季</option>
                <option value="4">冬季</option>
              </select>
              </td>
            </tr>
            <tr>
                <td  style="height: 40px">品类</td>
                <td colspan="8" style="height: 40px">
                   {volist name="category" id="vo"}
                    <input type="radio" value="{$vo.id}" name="category" style="width: auto; margin-left: 10px;" >{$vo.value}
                    {/volist}
                </td>
           </tr>
           <tr>
        <tr>
           <td>颜色</td>
           <td colspan="2">
              <select name="color" id=""  style="width: 100%;height: 100%;border: 0px;outline: none;">
                {volist name="color" id="vo"}
                <option value="{$vo.id}">{$vo.value}</option>
                {/volist}
              </select>
           </td>
           <td>号型</td>
           <td colspan="1">
             <select name="size" id=""  style="width: 100%;height: 100%;border: 0px;outline: none;">
                {volist name="size" id="vo"}
                <option value="{$vo.id}">{$vo.value}</option>
                {/volist}
              </select>
           </td>
           <td>价格</td>
           <td colspan="1">
               <input type="text" style="display: inline-block;width:auto;" name="price" value="{$data['price'] ?? ''}" required>
           </td>
           <td>数量</td>
           <td colspan="1">
             <input type="text" style="display: inline-block;width: auto;" name="num" value="{$data.num ?? ''}" required>
           </td>
       </tr>
               <td >款式细节</td>
               <td  colspan="8" >
                <textarea name="detail" id="" required cols="30" rows="10" style="border:0px;width: 100%;outline: none;">
                  {$data.detail ?? ''}
                </textarea>
            </td>
        </tr>
       <tr></tr>
   </table>
</div>  
</div>
<div class="form-group">
    <label class="col-sm-3 control-label">付款凭证：</label>
    <div class="col-sm-6">
        <input id="fileone" type="file" class="file-loading">
        <input type="hidden" id="picurl" placeholder="缩略图" name="picurl" value="{$data['picurl'] ?? ''}">
    </div>
</div>
<div class="panel-footer">
  <div class="row">
   <div class="col-sm-6 col-sm-offset-3">
     <input type="hidden" name="id" value="{$data.id ?? ''}">
     <button type="submit" class="btn btn-primary" style="display: block;margin:0 auto">提交</button>
     <!--  <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);" style="margin:0 auto">返回</button> -->
 </div>
</div>
</div><!-- panel-footer --> 
</form>
</div>
{/block}
{block name="js"}
<script src="__PLUGIN__/Fileinput/js/fileinput.js"></script>
<script>
 $(document).ready(function() {
    fileinputOne("fileone","picurl");
    var myDate = new Date();
    var y = myDate.getFullYear();  //获取当前年份
    $('#year').val(y);
     $("[name='category'][value='{$data.category ?? '1'}']").attr("checked", true);
    $("[name='sex'][value='{$data.sex ?? '8'}']").attr("checked", true);
    $("[name='size']").find("[value='{$data.size ?? '1'}']").attr("selected", true);
    $("[name='color']").find("[value='{$data.color ?? '1'}']").attr("selected", true);
    $("[name='season']").find("[value='{$data.season ?? '1'}']").attr("selected", true);
});
</script>
<script>
    function fileinputOne(fileid,field){
      var widths = arguments[2] ? arguments[2] : 'auto';//设置默认的图片宽度
      var heights = arguments[3] ? arguments[3] : '160px';//设置默认的图片高度
      //单图上传
      var $input = $("#"+fileid);
      var $picurl = $("#"+field); 
      
      var $Preview =[];
      var $Config =[];
      if($picurl.val()!=''){
       $Preview =["<img class='kv-preview-data file-preview-image' style='width:"+widths+";height:"+heights+";' src='"+$picurl.val()+"'>"];
       $Config =[{key: 1}];
   }
   $input.fileinput({
      uploadUrl: "{:url('index/common/upload')}",
      deleteUrl: "{:url('index/common/updel')}",
      autoReplace: true,
      overwriteInitial: true,
      showUploadedThumbs: false,
      maxFileCount: 1,
      initialPreview: $Preview,
      initialPreviewConfig: $Config,
      layoutTemplates: {actionDelete: ''}, 
  }).on("filebatchselected", function(event, files) {
          $input.fileinput("upload");//选择后自动上传
      }).on('fileuploaded', function(event, data,previewId,index) {
           //alert(JSON.stringify(data));
           var dataObj=eval("("+data.response+")");
            if(dataObj['code']==0)
                  {  
               $picurl.val(dataObj['img']);
                  }
           else{
            swal("出错了", "上传失败,请刷新再试", "error");
               }
    }).on("filecleared", function(event, files) {
       $picurl.val('');
   });

}
</script>
{/block}